﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using S4Store.Persistent;
using S4Store.Domain;
using LX.Core.Query;
using S4Store.Service.Valid.StoreValid;

namespace S4Store.Service
{
    public class ImproveGuideService : BaseService
    {

        public IQueryable<ImproveGuide> GetQuery()
        {
            return this.GetQuery<ImproveGuide>();
        }
        public void AddImproveGuide(ImproveGuide model)
        {
            if (String.IsNullOrEmpty(model.ImproveContent))
            {
                throw new Exception("请填写改善指导建议");
            }
            model.ImproveDate = DateTime.Now;
            this.GetSet<ImproveGuide>().Add(model);
        }

        public void Delete(int id)
        {
            var model = GetQuery().FirstOrDefault(o => o.Id == id);
            {
                ;
            }
            if (model != null)
            {
                this.GetSet<ImproveGuide>().Remove(model);
            }
        }

    }
}
